import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '@/plugins/element.js'

import elementui from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(elementui)




import  base_url from '@/plugins/baseUrl.js'
Vue.prototype.$baseUrl = base_url;


import axios from 'axios'
Vue.prototype.$axios = axios;

import qs from 'querystring'
Vue.prototype.$qs = qs

import '@/assets/css/global.css'

Vue.config.productionTip = false

//设置请求拦截器
axios.interceptors.request.use(config=>{
    let token=sessionStorage.getItem("token");
    if (token){
        config.headers["token"]=token;
    }
    return config;
});

//设置响应拦截器
axios.interceptors.response.use(config=>{
    if (config.data.code!=200){
        location.href="/login";
    }
    return config;
});




new Vue({
    router,
    render: h => h(App)
}).$mount('#app')
